import pygame


class Plant(pygame.sprite.Sprite):
    def __init__(self, imgs=[], size=(80, 80), position=(0,100), plantName="car"):
        super().__init__()
        self.images = imgs
        self.rect = (position[0], position[1], size[0], size[1])
        self.currentImgIndex = 0
        self.position = position
        self.size = size
        self.plantName = plantName
        self.count = 0

    def update(self):
        self.currentImgIndex += 1
        if self.currentImgIndex >= len(self.images):
            self.currentImgIndex = 0
            self.count += 1

    def draw(self, screen):
        screen.blit(self.images[self.currentImgIndex], self.rect)

    def collidePoint(self, point):
        if  point[0] > self.rect[0] and point[0] < (self.rect[0] + self.rect[2]) and point[1] > self.rect[1] and point[1] < (self.rect[1] + self.rect[3]):
            return True
        else:
            return False